home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / remotebt.lha / RemoteBoot.c < prev    next >
C/C++ Source or Header  |  1996-02-14  |  2KB  |  104 lines

  1. /*
  2. ** Remote booter Version 1.00
  3. ** By The Reaper
  4. **
  5. ** © 1996 Eden Software
  6. */
  7.  
  8. #define Prototype extern
  9.  
  10. #include <exec/types.h>
  11. #include <dos/dos.h>
  12.  
  13. #include <clib/dos_protos.h>
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18.  
  19. /* Globals */
  20. char *s;
  21. char *c;
  22. char *devs;
  23. char *libs;
  24. char *sys;
  25. char *l;
  26. char *t;
  27. char *boot;
  28.  
  29. /* Prototypes */
  30. Prototype void ReadConfig(void);
  31. Prototype void DoBoot(void);
  32.  
  33. main()
  34. {
  35.     printf("RemoteBoot Version 1.00 by The Reaper\n\n");
  36.  
  37.     ReadConfig();
  38. #ifndef DEBUG
  39.     printf("Booting...\n");
  40.     DoBoot();
  41. #else
  42.     printf("%s\n", s);
  43.     printf("%s\n", c);
  44.     printf("%s\n", l);
  45.     printf("%s\n", devs);
  46.     printf("%s\n", libs);
  47.     printf("%s\n", t);
  48. #endif
  49.     return(0);
  50. }
  51. void ReadConfig(void)
  52. {
  53.     FILE *fp;
  54.     char buf[256];
  55.     char *tmp;
  56.     
  57.     if(fp = fopen("s:Boot.cfg", "r"))
  58.     {
  59.         while(!feof(fp))
  60.         {
  61.             fgets(buf, sizeof(buf), fp);
  62.             
  63.             tmp = strtok(buf, "=");
  64.             
  65.             if(strcmp(tmp, "S") == NULL)
  66.                 s = strdup(strtok(NULL, "\n"));
  67.             
  68.             if(strcmp(tmp, "C") == NULL)
  69.                 c = strdup(strtok(NULL, "\n"));
  70.             
  71.             if(strcmp(tmp, "L") == NULL)
  72.                 l = strdup(strtok(NULL, "\n"));
  73.             
  74.             if(strcmp(tmp, "LIBS") == NULL)
  75.                 libs = strdup(strtok(NULL, "\n"));
  76.             
  77.             if(strcmp(tmp, "DEVS") == NULL)
  78.                 devs = strdup(strtok(NULL, "\n"));
  79.             
  80.             if(strcmp(tmp, "SYS") == NULL)
  81.                 sys = strdup(strtok(NULL, "\n"));
  82.             
  83.             if(strcmp(tmp, "T") == NULL)
  84.                 t = strdup(strtok(NULL, "\n"));
  85.             
  86.             if(strcmp(tmp, "BOOT") == NULL)
  87.                 boot = strdup(strtok(NULL, "\n"));
  88.         }
  89.         
  90.         fclose(fp);
  91.     }
  92. }
  93. void DoBoot(void)
  94. {
  95.     AssignPath("s", s);
  96.     AssignPath("c", c);
  97.     AssignPath("t", t);
  98.     AssignPath("l", l);
  99.     AssignPath("libs", libs);
  100.     AssignPath("devs", devs);
  101.     AssignPath("sys", sys);
  102.     
  103.     system(boot);
  104. }